package com.qf.openapi.web.master.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultVo<T> {

    private Integer code;

    private String msg;

    private Integer count;

    private List<T> data;

    public static <T> ResultVo<T> ok(Integer count, List<T> data) {

        final ResultVo<T> tableVo = new ResultVo<>();
        tableVo.setCode(0);
        tableVo.setMsg("OK");
        tableVo.setCount(count);
        tableVo.setData(data);

        return tableVo;
    }

    public ResultVo(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
